<template>
	<view>
		<image class="launch_image" src="../../static/launch/jiumenglaunch.jpg" mode="aspectFill"></image>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				
			};
		},
		onLoad:function(){
			
		},
		onReady:function(){
			this.requestHomeCategoryData();
		},
		methods: {
			/* 获取首页的分类配置 */
			requestHomeCategoryData() {
				var that = this;
				this.$api.requestHomeMusicTypes().then((res)=>{
					// 保存数据到全局变量
					getApp().globalData.homeMusicTypes = res.data;
					// 跳转到tabbar页面
					that.switchToTabHomePage();
				}).catch((err)=>{
					that.showTostAlert();
				})
			},
			/* 跳转到Tabbar的首页 */
			switchToTabHomePage() {
				uni.switchTab({
					url:"../home/home"
				});
			},
			/* 展示接口调用失败的弹框 */
			showTostAlert() {
				var that = this;
				uni.showModal({
				    title: '提示',
					content: '数据加载失败',
					confirmText: '重试',
					confirmColor: '#FF4040',
				    success: function (res) {
				        if (res.confirm) {
							that.requestHomeCategoryData();
				        }
				    }
				});
			},
			
			
		}
	}
</script>

<style lang="scss">
	
	.launch_image {
		position: fixed;
		width: 100%;
		height: 100%;
		top: 0;
		left: 0;
		z-index: -1;
	}
	
</style>
